package cn.ywang.spring.customized.demo.action;


import cn.ywang.spring.customized.demo.service.IDemoService;
import cn.ywang.spring.customized.framework.annotation.Autowired;
import cn.ywang.spring.customized.framework.annotation.Controller;
import cn.ywang.spring.customized.framework.annotation.RequestMapping;
import cn.ywang.spring.customized.framework.annotation.RequestParam;
import cn.ywang.spring.customized.framework.webmvc.ModelAndView;

import java.util.HashMap;
import java.util.Map;

/**
 * @author BeatificWang
 */
@Controller
@RequestMapping("/test")
public class MyAction {

	@Autowired
	IDemoService demoService;

	@RequestMapping("/index.html")
	public ModelAndView query(@RequestParam("name") String name) {
		System.out.println("调用成功啦");
		String result = this.demoService.get(name);
		Map<String, Object> model = new HashMap<>(2);
		model.put("name", name);
		return new ModelAndView("index.html", model);
	}

}
